Multithreading capability information retrieval

ABSTRACT

Embodiments relate to multithreading capability information retrieval. An aspect is a computer system includes a configuration with one or more cores configurable between a single thread (ST) mode and a multithreading (MT) mode. The ST mode addresses a primary thread and the MT mode addresses the primary thread and one or more secondary threads on shared resources of each core. The computer system also includes a multithreading facility configured to control utilization of the configuration to perform a method that includes executing, by the core, a retrieve multithreading capability information instruction. The execution includes obtaining thread identification information that identifies multithreading capability of the configuration, and storing the obtained thread identification information.

BACKGROUND

The present invention relates generally to a computer system supportingmultiple threads, and more specifically, to retrieval of multithreadingcapability information in a computer system.

As processor speed of computer systems has increased over the pastdecades, there has not been a proportional increase in the speed inwhich the memory of such computer systems can be accessed. Thus, thefaster the processor's cycle time, the more pronounced is the delay ofwaiting for data to be fetched from memory. The effects of such delayshave been mitigated by various levels of caching, and in recentprocessors, by multithreading (MT).

MT allows various core resources of a processor to be shared by aplurality of instruction streams known as threads. Core resources caninclude execution units, caches, translation-lookaside buffers (TLBs),and the like, which may be collectively referred to generally as a core.During latency caused by a cache-miss or other delay in one thread, oneor more other threads can utilize the core resources, thus increasingthe utilization of the core resources. In a super-scalar processorsimultaneous-multithreading (SMT) implementation, multiple threads maybe simultaneously serviced by the core resources of one or more cores.

In contemporary hardware platforms, MT is typically implemented in amanner that is transparent to an operating system (OS) that runs on theMT hardware. One aspect of this characteristic is that the OS does notrequire modification to utilize the MT hardware. However, transparent MToperation with respect to the OS can result in high variability ofresponse time, capacity provisioning, capacity planning, and billing.This variability can occur because the OS is unaware of whether itstasks have exclusive control of a core, or whether its tasks areexecuting as threads that share a core. By design, the highest capacityfor a memory-intensive workload on MT-capable hardware is achievablewhen there is a high average thread density when the cores are in use.Additional capacity may be due to increased cache exploitation providedby MT. If an OS does not consistently maintain high average threaddensities for utilized cores, then the additional overall throughputcapacity provided by MT will not be available. For example, if thehardware runs a single MT thread per core when there is low computeutilization and runs with high thread density when there is high computeutilization, then it can be very difficult to determine how much totalMT compute capacity is available to the workload. This hardwarevariability in the MT thread exploitation can lead to variability inboth transaction response times and in billing in a similar fashion aspreviously described with respect to capacity.

SUMMARY

Embodiments include a system, method, and computer program product formultithreading capability information retrieval. According to oneaspect, a computer system includes a configuration with one or morecores configurable between a single thread (ST) mode and amultithreading (MT) mode. The ST mode addresses a primary thread and theMT mode addresses the primary thread and one or more secondary threadson shared resources of each core. The computer system also includes amultithreading facility configured to control utilization of theconfiguration to perform a method that includes executing, by the core,a retrieve multithreading capability information (RMTCI) instruction.The execution includes obtaining thread identification information thatidentifies multithreading capability of the configuration, and storingthe obtained thread identification information.

According to another aspect, a computer-implemented method formultithreading capability information retrieval in a configuration isprovided. The configuration includes one or more cores configurablebetween an ST mode and an MT mode, where the ST mode addresses a primarythread and the MT mode addresses the primary thread and one or moresecondary threads on shared resources of each core. The method includesexecuting, by the core, a retrieve multithreading capability informationinstruction. The execution includes obtaining thread identificationinformation that identifies multithreading capability of theconfiguration, and storing the obtained thread identificationinformation.

A further aspect includes a computer program product for implementingmultithreading capability information retrieval in a configuration. Theconfiguration includes one or more cores configurable between an ST modeand an MT mode, where the ST mode addresses a primary thread and the MTmode addresses the primary thread and one or more secondary threads onshared resources of each core. The computer program product includes acomputer readable storage medium having program instructions embodiedtherewith, where the computer readable storage medium is not a signal.The program instructions are readable by a processing circuit to causethe processing circuit to perform a method. The method includesexecuting, by a core, a retrieve multithreading capability informationinstruction. The execution includes obtaining thread identificationinformation that identifies multithreading capability of theconfiguration, and storing the obtained thread identificationinformation.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

The subject matter which is regarded as embodiments is particularlypointed out and distinctly claimed in the claims at the conclusion ofthe specification. The forgoing and other features, and advantages ofthe embodiments are apparent from the following detailed descriptiontaken in conjunction with the accompanying drawings in which:

FIG. 1A depicts a computing environment that may be implemented inaccordance with an embodiment;

FIG. 1B depicts a computing environment that may be implemented inaccordance with an embodiment;

FIG. 2 depicts processing circuitry of a core that may be implemented inaccordance with an embodiment;

FIG. 3 depicts a computing environment that may be implemented inaccordance with an embodiment;

FIG. 4 depicts an example of hypervisor context retention in a computingenvironment that may be implemented in accordance with an embodiment;

FIG. 5 depicts a process flow for dynamic enablement of multithreadingin accordance with an embodiment;

FIG. 6A depicts an example of a CPU address expansion process inaccordance with an embodiment;

FIG. 6B depicts an example of a CPU address contraction process inaccordance with an embodiment;

FIG. 7 depicts a process flow for a set-multithreading order inaccordance with an embodiment;

FIG. 8 depicts an example of storing multithreading capabilityinformation in accordance with an embodiment;

FIG. 9 depicts a process flow for determining multithreading capabilityin accordance with an embodiment;

FIG. 10 depicts an example of various thread context locations inaccordance with an embodiment;

FIG. 11 depicts an example of multithreading register preservation inaccordance with an embodiment;

FIG. 12 depicts a process flow for multithreading register preservationin accordance with an embodiment;

FIG. 13 depicts an example of multithreading register restoration inaccordance with an embodiment;

FIG. 14 depicts a process flow for multithreading register restorationin accordance with an embodiment; and

FIG. 15 depicts a computer-readable medium according to an embodiment.

DETAILED DESCRIPTION

Exemplary embodiments provide multithreading operation in a computersystem that supports a single thread and a multithreading mode ofoperation. As used herein, a logical thread refers to a singleinstruction stream and its associated state. That is, at an architecturelevel, each logical thread represents an independent central processingunit (CPU) or processor. At a hardware level, a thread is the executionof an instruction stream associated with a logical thread, combined withthe maintaining of that guest state, when the thread is dispatched.Therefore, the terms “thread” and “CPU” may be used interchangeablyherein.

In an exemplary embodiment, a CPU contains sequencing and processingfacilities for instruction execution, interruption action, timingfunctions, initial program loading, and other machine-related functions.A CPU defines logical functions that may map to a variety of underlyingphysical implementations. The CPU, in executing instructions, canprocess binary integers and floating-point numbers (e.g., binary,decimal, and hexadecimal) of fixed length, decimal integers of variablelength, and logical information of either fixed or variable length.Processing may be in parallel or in series. The width of processingelements, multiplicity of shifting paths, and the degree of simultaneityin performing different types of arithmetic can differ from one model ofCPU to another without affecting the logical results.

Instructions which the CPU executes can include a number of instructionclasses, such as: general, decimal, floating-point-support (FPS),binary-floating-point (BFP), decimal-floating-point (DFP),hexadecimal-floating-point (HFP), control, and I/O instructions. Thegeneral instructions can be used in performing binary-integer-arithmeticoperations and logical, branching, and other non-arithmetic operations.The decimal instructions operate on data in decimal format. The BFP,DFP, and HFP instructions operate on data in BFP, DFP, and HFP formats,respectively, while the FPS instructions operate on floating-point dataindependent of the format or convert from one format to another.Privileged control instructions and the I/O instructions can be executedwhen the CPU is in a supervisor state, and semi-privileged controlinstructions can be executed in a problem state, subject to appropriateauthorization mechanisms.

The CPU provides registers which are available to programs but do nothave addressable representations in main storage. The registers caninclude, for instance, a current program-status word (PSW), generalregisters, floating-point registers and a floating-point-controlregister, vector registers, control registers, access registers, aprefix register, a time-of-day (TOD)-programmable register, andregisters for a clock comparator and CPU timer. This set of registersmay be referred to as the CPU's architected register context. Each CPUin a configuration can provide access to a TOD clock, which may beshared by all CPUs in the configuration. An instruction operation codecan determine which type of register is to be used in an operation.

Each CPU may have a type attribute that indicates whether it provides afull complement of functions and facilities (e.g., a general CPU), orwhether it is intended to process specific types of workloads (e.g., aspecialty CPU). A primary CPU is either a general CPU or a CPU havingthe same type as the CPU started following a last initial program load(IPL) operation (the IPL CPU). A secondary CPU is any CPU other than ageneral CPU having a CPU type that differs from the IPL CPU.

A multithreading facility may be available on a computer system thatimplements a supporting architecture. The multithreading facilityprovides support for multithreading to enable a group of threads, whichmay also be referred to as CPUs, that share a core. When themultithreading facility is enabled, the CPUs within a core may sharecertain hardware resources such as execution units or caches. When oneCPU in a core is waiting for hardware resources (typically, whilewaiting for a memory access), other CPUs in the core can utilize theshared resources in the core rather than have them remain idle. When themultithreading facility is installed and enabled, a thread is synonymouswith a CPU that is a member of a core. When the multithreading facilityis not installed, or the facility is installed but not enabled, a corecomprises a single CPU or thread.

When the multithreading facility is installed, it may be enabled byexecution of a set-multithreading signal processor (SIGP) order. In anexemplary embodiment, when the multithreading facility is enabled, thenumber of CPUs in a configuration is increased by a multiple, the valueof which is determined by a program-specified maximum threadidentification (PSMTID). The number of CPUs in a core can be one morethan the PSMTID. A number of CPUs corresponding to this multiple aregrouped into a core. Each core of the same CPU type in a configurationcan have the same number of CPUs. Each CPU within a core is of the sameCPU type; however, based on the model and CPU type, some CPUs within acore may not be operational.

In an exemplary embodiment, a control program, such as an operatingsystem (OS), explicitly enables multithreading in order for it to beusable by the configuration that the OS manages. Alternatively, ahypervisor can enable multithreading and guests of the hypervisor andtheir applications can benefit transparently. An application program isgenerally unaware of whether multithreading has been enabled. Whenmultithreading is enabled, the CPU addresses of all CPUs in theconfiguration are adjusted to include a core identification (or core ID)in the leftmost bits of the address and a thread identification (threadID, or TID) in the rightmost bits of the address. The core ID may alsobe referred to as a core address value, and the TID may be referred toas a thread address value. CPUs within a core may share certain hardwarefacilities such as execution units or lower-level caches, thus executionwithin one CPU of a core may affect the performance of other CPUs in thecore.

In order to manage changes associated with dynamically switching one ormore cores of a configuration between single thread and multithreadingmodes, a number of support features are included. To maintaincompatibility with programs that do not support multithreading, a singlethread mode may be the default mode upon a reset or deactivation.Exemplary embodiments include features to preserve, communicate, andrestore thread context from the multithreading mode to support analysisand/or restoration of the thread context after transitioning from themultithreading mode to the single thread mode.

A computing environment that may be implemented by an exemplaryembodiment can be based, for example, on the z/Architecture offered byInternational Business Machines Corporation, Armonk, N.Y. Thez/Architecture is described in an IBM® publication entitled,“z/Architecture Principles of Operation,” IBM Publication No.SA22-7832-09, August 2012, which is hereby incorporated herein byreference in its entirety. In one example, a computing environment basedon the z/Architecture includes an eServer zSeries, offered byInternational Business Machines Corporation, Armonk, N.Y. A computingenvironment can include, for example, a processor complex with one ormore partitions (e.g., logical partitions) with one or more cores (e.g.,processor cores), and one or more levels of hypervisors as furtherdescribed herein.

FIG. 1A shows a computer system 100 as an example of a computingenvironment that supports multithreading (MT). In the example of FIG.1A, the computer system 100 includes a plurality of processor cores 102,an input/output (I/O) subsystem 104, and system memory 160. The I/Osubsystem 104 can provide access to I/O devices known in the art. Theprocessor cores 102, also referred to simply as “cores” herein, caninclude processing circuitry with supporting elements. In the example ofFIG. 1A, five cores 102 are depicted as core1 110, core2 120, core3 130,core4 140, and core5 150; however, a greater or fewer number of cores102 is also contemplated. An MT facility 103 may be a hardware componentof each of the cores 102. In this example, each of the cores 102 iscapable of supporting up to four threads. For instance, core1 110 cansupport threads 111, 112, 113, and 114. Core2 120 can support threads121, 122, 123, and 124. Core3 130 can support threads 131, 132, 133, and134. Core4 140 can support threads 141, 142, 143, and 144. Core5 150 cansupport threads 151, 152, 153, and 154. Note that not all four threadsof each core 102 may be operational at any instant. For example, incore3 130, threads 131 and 132 can be operational while threads 133 and134 are allowed to be operational (depicted with shading).

FIG. 1A also depicts the system memory 160 of the computer system 100,where parts of the system memory 160 are apportioned to logicalpartition1 (LPAR1) 170, LPAR2 180, and LPAR3 190. The LPARs 170, 180,190 represent virtualized computing systems (also known asconfigurations) in which an operating system such as Linux™ or the IBM®z/OS™, z/VM, or zTPF operating system may be executed. FIG. 1A alsoshows the apportionment of the cores 102 to the LPARs 170, 180, 190. Inthis illustration, core1 110 and core2 120 are dedicated for use byLPAR1 170. Core3 130 is dedicated for use by LPAR2 180, and core5 150 isdedicated for use by LPAR3 190. Core4 140 may be shared between LPAR2180 and LPAR3 190, but is shown as being assigned to LPAR2 180 in FIG.1A. LPAR3 190 shows an example of two different types of cores 102 beingemployed by the partition, where core4 140 allows multiple threads to beoperational, but core5 150 does not allow multiple threads to beoperational in this example. In the example of FIG. 1A, LPAR1 170provides processing resources for OS 171 and programs 172, 173, 174, and175. LPAR2 180 provides processing resources for OS 181 and programs182, 183, and 184. LPAR4 190 provides processing resources for OS 191and programs 192 and 193.

Under control of an operating system executing in an LPAR, programs areexecuted on the threads of a core. In an exemplary embodiment, anindividual thread executes only one program at time; however, a programthat is designed to be re-entrant may be executed on multiple threads orcores simultaneously. For example, program 172 of OS 171 of LPAR1 170may be executing on threads 111 and 113 in core1 110 and in threads 121and 124 of core2 120. Subject to the control of an OS, differentprograms may be dispatched on the same or different threads, subject todispatching rules and quality-of-service agreements.

Also residing in the system memory 160 are various levels of firmware,including for example, Millicode 162 and LPAR hypervisor 163. TheMillicode 162 can be embodied as firmware to support lower-level systemfunctions. The LPAR hypervisor 163 may be, for example, licensedinternal code such as the IBM Processor-Resource/System Manager™(PR/SM™). The LPAR hypervisor 163 can establish the LPARs 170, 180, 190and may manage dispatching on the cores 102. When the MT facility 103 isinstalled in the computer system 100, the Millicode 162 and LPARhypervisor 163 also contain MT facility support code 164 and 165respectively. The MT facility support code 164 and 165 may be consideredpart of the MT facility 103, as logic to support MT can be distributedbetween the Millicode 162, LPAR hypervisor 163, and the cores 102.Although not depicted, each of the OSs 171, 181, 191 can also include MTfacility support code to enable and exploit MT in their respective LPARs170, 180, 190.

FIG. 1B shows the same computing system 100 as FIG. 1A, except that inthe computing environment of FIG. 1B, core4 140 is now assigned to LPAR3190 instead of LPAR2 180. Also note that unlike FIG. 1A, where threads143 and 144 were not operational, in FIG. 1B, all four threads 141-144are currently operational when LPAR3 190 is dispatched on core4 140. Thedispatching and undispatching of an LPAR on a core 102 is dynamic, andat other times other LPARs (not shown) may be operating on the samecores 102.

Turning now to FIG. 2, a block diagram of processing circuitry 200 forimplementing a processing core, such as one of the cores 102 in FIGS. 1Aand 1B, is generally shown in accordance with an embodiment. Theprocessing circuitry 200 is an example of a processing circuit that cansupport one or more threads simultaneously in a MT environment. Theprocessing circuitry 200 shown in FIG. 2 includes a system controllerinterface unit 202 that can couple the processing circuitry 200 to otherprocessors and peripheral devices. The system controller interface unit202 can also connect a Dcache 204, which reads and stores data values,an Icache 208, which reads program instructions, and a cache interfaceunit 206 to external memory, processors, and other peripheral devices.

The Icache 208 can provide loading of instruction streams in conjunctionwith an instruction fetch unit (IFU) 210, which pre-fetches instructionsand may include speculative loading and branch prediction capabilities.The fetched instructions can be provided to an instruction decode unit(IDU) 212 for decoding into instruction processing data.

The IDU 212 can provide the instructions to an issue unit 214 which cancontrol the issuing of the instructions to various execution units, suchas one or more fixed point units (FXU) 216 for executing generaloperations and one or more floating point units (FPU) 218 for executingfloating point operations. The FPUs 218 can include a binary floatingpoint unit (BFU) 220, a decimal floating point unit (DFU) 222, or anyother floating point unit. The issue unit 214 can also be coupled to oneor more load/store units (LSU) 228 via one or more LSU pipelines. Themultiple LSU pipelines are treated as execution units for performingloads and stores and address generation for branches. Both the LSU 228and the IFU 210 can utilize a translation-lookaside-buffer (TLB) 230 toprovide buffered translations for the operand and instruction addresses.

The FXU 216 and FPU 218 are coupled to various resources such asgeneral-purpose registers (GPR) 224 and floating point registers (FPR)226. The GPR 224 and FPR 226 provide data value storage for data valuesloaded and stored from the Dcache 204 by a LSU 228.

The processing circuitry 200 can also include counters and/or timers 250to support system time-base generation and diagnostic actions. Forexample, the counters and/or timers 250 may be used to supporttime-of-day, as well as various diagnostic and measurement facilities.

Turning now to FIG. 3, a computing environment similar to FIG. 1A isdepicted except that in FIG. 3, a second-level hypervisor 300 isexecuting in LPAR2 180 of the computer system 100. The second-levelhypervisor 300, for example, the IBM z/VM operating system, includes MTsupport code 301, similar to the MT support code 165 provided by theLPAR (first-level) hypervisor 163. The second-level hypervisor 300provides support for a plurality of virtual machines 310, 320, and 330(also referred to as configurations) in which guest operating systems311, 321, and 331 operate respectively. The guest operating systems 311,321, and 331 may include, for example, Linux™ or the IBM® z/OS™, z/VM,or z/TPF OS, or may include a guest development environment such as theIBM conversational monitor system (CMS). Each guest OS 311, 321, and 331may or may not enable multithreading, in which case the second-levelhypervisor 300 may be responsible for dispatching the guest OSs 311,321, 331 and associated programs 312, 313, 322, 323, 332, and 333 usingthe physical processing resources (cores 130, 140 and threads 131-134,141-144) that are available to the LPAR2 180 in which the second-levelhypervisor 300 operates. The programs 312, 313, 322, 323, 332, 333 ofthe various virtual machines 310, 320, 330 can execute on the threads131-134, 141-144 available to the respective guest OSs 311, 321, and331. The guest OSs 311, 321, and 331 need not include MT support code,as they can benefit from MT transparently if the second-level hypervisor300 exploits multithreading.

Turning now to FIG. 4, an example of hypervisor context retention in acomputing environment that may be implemented in accordance with anembodiment is depicted. In the example of FIG. 4, a number of supportstructures are depicted within the LPAR hypervisor 163 of FIGS. 1A and1B. For example, structures 410 can support LPAR1 170 of FIG. 1A,including state descriptions and satellite blocks that store architectedregister context (i.e., thread context) for logical threads 411, 412,413, 414, 421, 422, 423, 424 which are currently running on physicalthreads 111, 112, 113, 114, 121, 122, 123, 124 as shown in FIG. 1A.While these logical threads are dispatched, the physical threads holdthe current architected register context of the threads. The architectedregister context will be maintained in the state descriptions andsatellite blocks when they are no longer dispatched. Structures 430 cansupport LPAR2 180 of FIG. 1A, including state descriptions and satelliteblocks that store architected register context for logical threads 431,432, 441, 442 which are currently running on physical threads 131, 132,141, 142 as shown in FIG. 1A. Structures 450 can support LPAR3 190 ofFIG. 1A, including state descriptions and satellite blocks that storearchitected register context for logical threads 451 which is currentlyrunning on physical thread 151 as shown in FIG. 1A. Structures 450 alsoinclude state descriptions and satellite blocks that store architectedregister context for logical threads 461, 462, 463 and 464 which are notcurrently dispatched on a physical processor (as shown with shading).Other structures supporting LPARs that are not dispatched on physicalcores can also be retained by the LPAR hypervisor 163, such asstructures 470 for an LPAR A (not depicted in FIG. 1A) including statedescriptions and satellite structures for logical threads 471, 472, 473,and 474. Further structure examples include structures 480 supportingnon-dispatched LPAR B (not depicted in FIG. 1A) including statedescriptions and satellite structures for logical threads 481 and 482,as well as structures 484 for non-dispatched LPAR C (not depicted inFIG. 1A) for logical thread 485.

Although a number of structures are depicted in the example of FIG. 4,it will be understood that additional structures can be supported by theLPAR hypervisor 163 and elsewhere in computer system 100 to managemultithreading. For example, structures to support multithreading ofvirtual machines 310, 320, 330 of FIG. 3 can be retained by thesecond-level hypervisor 300 of FIG. 3.

Turning now to FIG. 5, a process flow 500 for dynamic enablement ofmultithreading is depicted in accordance with an embodiment. At block502, a primary thread executes in a single thread (ST) mode. At block504, a multithreading (MT) mode setting instruction is fetched in the STmode. In executing this instruction as depicted collectively at 505, anumber of threads requested from a location specified by the MT modesetting instruction is obtained at block 506. The location can bespecified by a parameter register when issuing the set-MT modeinstruction. The MT mode setting instruction can be a signal processor(SIGP) instruction including a set-MT order and a program-specifiedmaximum thread-id (PSMTID) associated with the number of threadsrequested. An example of a process associated with a set-MT order of aSIGP instruction is further described herein in reference to FIG. 7.

Continuing with process 500, at block 508, a determination is performedas to whether the number of threads requested indicates multiplethreads. For example, multiple threads can be indicated by a valuegreater than one. In embodiments where a value of zero indicates asingle thread, a value of one or more than one can indicate multiplethreads. Based on determining that the number of threads requested doesnot indicate multiple threads, the core remains in ST mode at block 510,the execution of the set-MT mode instruction is complete, and controlreturns to block 502. Based on determining that the number of threadsrequested indicates multiple threads, MT mode is enabled at block 512,and the execution of the set-MT mode instruction is complete. At block514, multiple threads are executed including the primary and one or moresecondary threads. At block 516, if there is no reset or deactivation,the process 500 loops back to block 514; otherwise, at block 518, MTmode is disabled based on a reset or a deactivation of the configurationwhich reverts to ST mode. As part of disabling the MT mode, the numberof threads (PSMTID) is retained for a non-clearing reset or zeroed for aclearing reset. The process 500 returns to block 502.

A CPU can enter a load state when a load-normal, load-with-dump,load-clear, or load-clear-list-directed key is activated. If achannel-command word (CCW)-type initial-program-loading operation iscompleted successfully, the CPU changes from the load state to theoperating state.

A CPU reset can be used to clear equipment-check indications and anyresultant unpredictability in the CPU state with the least amount ofinformation destroyed. In particular, it can be used to clear checkconditions when the CPU state is to be preserved for analysis orresumption of the operation. If a CPU reset is caused by the activationof the load-normal or load-with-dump key, (a) it can set anarchitectural mode to a default mode, and (b) if the multithreadingfacility is installed and enabled, multithreading is disabled. When theCPU reset sets the default mode, it can save the current PSW so that PSWcan be restored.

An initial CPU reset provides functions of a CPU reset together withinitialization of the current PSW, CPU timer, clock comparator, andother registers, such as: breaking-event-address, captured-PSW, control,floating-point-control, prefix, and TOD programmable registers. Theinitial CPU reset can set the architectural mode to the default mode ifit is caused by activation of the load-normal or load-with-dump key. Ifmultithreading is enabled when an initial CPU reset is caused byactivation of the load-normal or load-with-dump key, theinitial-CPU-reset functions can be performed for the lowest-numbered CPUof a core, and the CPU reset is performed for all other CPUs in thecore. A clearing reset causes the initial CPU reset and subsystem resetto be performed and, additionally, clears or initializes all storagelocations and registers in all CPUs in the configuration, with theexception of the TOD clock. Clearing does not affect external storage,such as direct-access storage devices used by the control program tohold the contents of unaddressable pages.

A CPU power-on reset causes the initial CPU reset to be performed andclears the contents of general registers, access registers, controlregisters, and floating-point registers to zeroes/default values with avalid checking-block code. It will be understood that clearing orinitializing of states need not be to zero values but can default tonon-zero values in the cleared state. If a CPU power-on resetestablishes the configuration, it can set the architectural mode to thedefault mode; otherwise, it may set the architectural mode to that ofthe CPUs already in the configuration. CPU reset, initial CPU reset,subsystem reset, and clear reset may be initiated manually.

In exemplary embodiments, each CPU has a number assigned, called its CPUaddress. A CPU address uniquely identifies one CPU within aconfiguration. A CPU is designated by specifying this address in aCPU-address field of a SIGP instruction. A CPU signaling a malfunctionalert, emergency signal, or external call can be identified by storingthis address in the CPU-address field with the interruption. The CPUaddress is assigned by a configuration-definition process and is nottypically changed as a result of reconfiguration changes. A program candetermine the address of a CPU by using a store CPU address instruction.The store CPU address instruction can also be used to identify a CPUaddress by which a CPU is identified in a multiprocessing configuration.

When multithreading is enabled, the CPU address can include a coreidentification (core ID), concatenated with an identification of a CPUwithin the core. The CPU identification within a core is a threadidentification (thread ID, or TID). Within a configuration, all coresprovide the same number of CPUs; however, depending on the model and CPUtype, some CPUs in a core may not be operational.

Based on the PSMTID of a parameter register used by the signal processorset multithreading order, a fixed number of bits represent the threadidentification. This number of bits is referred to as the TID width.

The core ID can be formed from the rightmost bits of the CPU addressbefore multithreading is enabled. The core ID is shifted left byTID-width bits, resulting in the leftmost bits of the CPU address aftermultithreading is available. The thread ID has the same TID-width numberof bits, and occupies the rightmost bits of the CPU address aftermultithreading is enabled. Thread IDs can be assigned in a contiguousrange of numbers. Table 1 illustrates an example relationship of thePSMTID, the TID width and the CPU-address bits comprising the coreidentification and thread identification.

TABLE 1 Example address bit mapping CPU Address Bits PSMTID TID WidthCore ID Thread ID 0 0 0-15 — 1 1 0-14 15 2-3 2 0-13 14-15 4-7 3 0-1213-15  8-15 4 0-11 12-15 16-31 5 0-10 11-15

Address expansion is depicted in FIG. 6A as an example of a CPU addressexpansion process 600A in accordance with an embodiment. At block 602, aprimary thread can be accessed in the ST mode using a core address value604 as a number of CPU address bits. Arrow 606 indicates switching fromthe ST mode to the MT mode. At block 608, the primary thread or one ormore secondary threads can be accessed in the MT mode using an expandedaddress value 610. The expanded address value 610 includes the coreaddress value 604 shifted as a shifted core address value 612 andconcatenated with a thread address value 614. The shifted core addressvalue 612 is a core identifier (core ID), and the thread address value614 is a thread identifier (TID). The shifted core address value 612 canbe shifted by an amount based on a requested maximum thread identifier,e.g., PSMTID. A number of TID bits in the thread address value 614 canbe determined based on the PSMTID as shown in table 1 above. The threadaddress value 614 can be concatenated to low order bits of the shiftedcore address value 612 to form the expanded address value 610. A threadaddress value 614 of all zeroes would designate the primary thread, andvalues greater than zero identify and address secondary threads.

When switching between the MT mode and ST mode, either the core addressvalue 604 (ST mode) or the expanded address value 610 (MT mode) isselected to use as a CPU address in a respective ST mode or MT mode. Thecore address value 604 is an example of a standard-format address usedin ST mode, and the core reverts from the MT mode to the ST mode basedon disabling the MT mode. In an exemplary embodiment, only the primarythread (i.e., not secondary threads) is accessible based on disablingthe MT mode. FIG. 6B depicts an example of a CPU address contractionprocess 600B in accordance with an embodiment. Arrow 616 of FIG. 6Billustrates switching from the MT mode of block 608 back to the ST modeof block 602. Reversion from the MT mode to the ST mode can includeshifting the expanded address value 610 to the right and eliminating thethread address value 614 to form a standard-format address including thecore address value 604 (core ID) as the CPU address from the shiftedcore address value 612.

When a reset function disables multithreading, (a) the CPU address(es)of the CPU(s) having the thread-ID zero are shifted to the right by thesame TID-width number of bits used during enablement, (b) zeroes areinserted in the TID-width number of bits on the left of the address, and(c) the CPU address reverts to its original non-multithreading format(i.e., standard-format address). All CPUs in a core having nonzerothread IDs when multithreading is enabled are no longer operational whenmultithreading is disabled.

When multithreading is not enabled, the CPU address remains unchangedfrom the value assigned by the configuration-definition process. In thiscase, the thread identification does not exist.

A number of signal processor orders can provide orders to CPUsincluding, for example, start, stop, restart, stop and store status,initial CPU reset, CPU reset, store status at address, set architecture,sense running status, set multithreading, store additional status ataddress, and the like. An initial CPU reset or a CPU reset can beinitiated by a signal processor instruction and does not affect thearchitectural mode or other CPUs, does not disable multithreading, anddoes not cause I/O to be reset.

A set architecture order specifies an architectural mode to which allCPUs in the configuration are to be set. Architecture differences caninclude different addressing modes, register definitions, andinstructions supported by the CPUs. Upon a change in architectural mode,select bit fields of registers can be set to a default state (e.g.,zeroed), access-register-translation lookaside buffers (ALBs) andtranslation lookaside buffers (TLBs) of all CPUs in the configurationare cleared, and a serialization and checkpoint-synchronization functioncan be performed on all CPUs in the configuration.

A sense running status order can indicate whether an addressed CPU isrunning. In ST mode, an indicator can be returned as a running/notrunning status. In MT mode, an indicator can be used to identify whetherany CPU of the core in which the addressed CPU is a member is running,or all CPUs of the core in which the addressed CPU is a member are notrunning.

A set-MT order enables the multithreading facility. Bit positions of aparameter register can contain the PSMTID to be provided in theconfiguration. The PSMTID can be defined as one less than the number ofCPUs to be made addressable in each core. For example, a value of 3 indesignated bit positions indicates that a maximum of four threads are tobe provided. The contents of a CPU-address register of the SIGPinstruction can be ignored as all CPUs in the configuration areconsidered to be addressed. If accepted, the set-MT order is completedby all CPUs during the execution of the SIGP instruction. With referenceto FIG. 7, a process 700 for a SIGP set-MT order 702 is depicted. Anerror indication can be provided and enablement of the MT mode preventedbased on determining that the SIGP set-MT order 702 was issued with oneor more of: an invalid order, an incorrect state, and an invalidparameter, as further described herein in reference to the process 700of FIG. 7.

If the multithreading facility is not installed at block 704 or the CPUis not enabled in a valid architecture mode 708, then the set-MT orderis not accepted and an invalid order indication may be returned atblocks 706 or 710 respectively. If the other CPUs in the configurationare not in the stopped or check-stop state at block 712, or if theconfiguration is already enabled for multithreading at block 716, theset-MT order is not accepted and an incorrect state indication may bereturned at block 714 or 718 respectively.

If the PSMTID is invalid at block 720, then the set-MT order is notaccepted and an invalid parameter indication may be returned at block722. When the PSMTID is zero at block 724, the configuration is notenabled for multithreading, remains in ST mode, and provides any statusas a condition code at block 728. In an exemplary embodiment, when thePSMTID is valid and nonzero, at block 726, the configuration is enabledfor multithreading, resulting in CPU-address expansion, the ALBs andTLBs of all CPUs in the configuration are cleared of their contents, anda serialization and checkpoint-synchronization function is performed onall CPUs in the configuration. Status can be provided at block 728 in acondition code. Upon successful completion, all CPUs other than the CPUexecuting the set-MT order remain in the stopped or check-stop state.However, if a CPU was in the check-stop state before multithreading isenabled, it may be unpredictable whether the CPUs having nonzero threadIDs in the same core are placed in the stopped or check-stopped state.

A thread context may also be referred to as an architected registercontext. The architected register context (that is, the contents of thePSW, CPU timer, clock comparator, general registers, floating-pointregisters and floating-point control register, vector registers, controlregisters, access registers, prefix register, and TOD-programmableregister, etc.) of each CPU before multithreading is enabled becomes thearchitected register context of the CPU having TID zero of eachrespective core after multithreading is enabled. Similarly, thearchitected register context of the CPU having TID zero of each core ofan MT-enabled configuration becomes the architected register context ofeach respective CPU when multithreading is disabled as a result of theactivation of a load-normal or load-with-dump key.

The architected register context of all CPUs having a nonzero threadidentification can be retained when the multithreading facility isdisabled as a result of the activation of a load-normal orload-with-dump key operation. If the multithreading facility issubsequently re-enabled without an intervening clear reset, thearchitected register context of all CPUs having a nonzero threadidentification are restored.

When multithreading is re-enabled after having been disabled by theactivation of the load-normal or load-with-dump key, if the value of thePSMTID in bits of the parameter register differs from that used in thepreceding enablement, then the architected register context of all CPUshaving nonzero thread IDs can be unpredictable.

A store system information instruction can be used to store informationabout a component or components of a configuration into asystem-information block (SYSIB). The SYSIB can include an MT installedfield, an MT general field, a total CPU/core count, a configuredCPU/core count, a standby CPU/core count, a reserved CPU/core count, andother fields. The MT installed field can indicate whether themultithreading facility is installed and may also indicate the highestsupported TID for a first core type, e.g., a specialty core type. The MTgeneral field can indicate the highest supported TID for a second coretype, e.g., a general core type. The highest supported TID in the MTgeneral field may be limited to being less than or equal to the highestsupported TID in the MT installed field. The total CPU/core count mayindicate a total number of general CPUs or cores comprising general CPUsin the configuration, whether in the configured, standby, or reservedstate. The configured CPU/core count can indicate a number of generalCPUs or cores comprising general CPUs in the configured state, i.e., inthe configuration and ready to execute programs. The standby CPU/corecount indicates a number of general CPUs or cores comprising generalCPUs in the standby state, i.e., not available to be used to executeprograms until placed in the configured state. The reserved CPU/corecount indicates a number of general CPUs or cores comprising generalCPUs in the reserved state, i.e., unavailable to be used to executeprograms and unable to be placed in the configured state.

FIG. 8 depicts an example of storing multithreading capabilityinformation in accordance with an embodiment. A program executing in athread, such as thread1 of core 800A, may fetch a STORE SYSTEMINFORMATION (STSI) instruction 830 from memory 801 of a configuration850 such as an LPAR. The execution of the STSI instruction may result inthe storing 832 of a system information block (SYSIB) 802. In theexample of FIG. 8, the SYSIB 802 includes an MT installed identifier 804indicating whether the configuration 850 supports multithreading. TheSYSIB 802 also includes a maximum thread identifier of a highestsupported thread of a core 800A/800B that can be provided as a maximumTID per core 806 for specialty cores and a maximum TID for general cores808. The SYSIB 802 may also include a current program-specified maximumthread identifier (PSMTID) 809. The current PSMTID 809 reflects amultithreading mode as enabled in configuration 850 by the program. Thecurrent PSMTID 809 may not be defined if the STSI instruction 830 isexecuted at a basic-machine level.

A program executing in a thread, such as thread2 of a core 800B, mayalso fetch a SERVICE CALL (SERVC) instruction 834 from memory 801 of theconfiguration 850, where the instruction specifies aread-system-control-program-information (read-SCP-info, or RSCPI)command. The execution of the RSCPI command may cause a service-callcontrol block (SCCB) 810 to be stored 836 in the memory 801. In anexemplary embodiment, the SCCB 810 stored by the execution of the RSCPIcommand provides similar and additional information that may not beavailable in the SYSIB 802. In the example of FIG. 8, the SCCB 810includes an MT installed identifier 812 indicating whether the core 800Bsupports multithreading. The SCCB 810 also includes a maximum threadidentifier of a highest supported thread of the core 800B that can beprovided as a maximum TID per core 814 for specialty cores and a maximumTID for general cores 816. The values of 812-816 of the SCCB 810 areequivalent to the values 804-808 that may be accessible in the SYSIB802. Additionally, the SCCB 810 can include a last-set program-specifiedmaximum thread identifier of a highest supported thread of the core800B, which is also referred to the as a last-set program-specifiedmaximum thread identifier (PSMTID) 818. The SCCB 810 can also include amask of PSMTID values acceptable on the set-MT order as a PSMTIDsupported mask 820. The PSMTID supported mask 820 can be used toidentify supported CPUs/threads when fewer than the number defined bythe max TID per core 814 are desired.

It will be understood that the cores 800A and 800B include other aspectsthat are not depicted in this example. Furthermore, the SYSIB 802 andthe SCCB 810 can include additional values beyond those depicted in theexample of FIG. 8.

FIG. 9 depicts a process flow 900 for determining multithreadingcapability in accordance with an embodiment. At block 902, the coreexecutes a retrieve multithreading capability information (RMTCI)instruction, which can be, for instance, any one of a SERVC instructionor a STSI instruction. At block 904, thread identification informationis obtained that identifies a multithreading capability of aconfiguration. At block 906, the obtained thread identificationinformation is stored. At block 908, it is determined whether theconfiguration previously had multithreading enabled based on theobtained thread identification information.

As previously described, the SERVC instruction is configured to storethread identification information in a response block in memory (e.g.,SCCB 810 of FIG. 8), and the STSI instruction is configured to store thethread identification information in a SYSIB in memory (e.g., SYSIB 802of FIG. 8). The obtained thread information can include an MT installedidentifier (e.g., MT installed identifier 804 or 812 of FIG. 8)indicating whether the core supports multithreading. The obtained threadinformation may also include a maximum thread identifier of a highestsupported thread of the core (e.g., maximum TID values 806, 808, 814, or816 of FIG. 8). The obtained thread information can include a currentprogram-specified maximum thread identifier (e.g., current PSMTID 809 ofFIG. 8) and a last-set program-specified maximum thread identifier(e.g., PSMTID 818 of FIG. 8). The response block can include a mask ofbits indicating specific thread identifiers that are individuallysupported (e.g., PSMTID supported mask 820 of FIG. 8). The determinationthat the configuration previously had MT enabled may be based on anon-zero value in the last-set program-specified maximum threadidentifier (e.g., last-set PSMTID>0). In an exemplary embodiment, theconfiguration supports a plurality of core types.

In exemplary embodiments, registers and values such as program countervalues, which may be included in the registers or managed separately,are captured as thread context. When address expansion occurs in MTmode, additional thread context becomes accessible. As previouslydescribed in reference to FIG. 6, a CPU address is formed for each corein a configuration. The CPU address may be inspected by the store CPUaddress instruction, it appears in other structures, and it is used invarious SIGP orders. When MT is not enabled, this addressing schemeremains unchanged. When MT is enabled, the CPU address undergoes anexpansion process. As previously described, the non-MT-enabled portionof the CPU address can be shifted left sufficient bits to accommodatethe TID. For example, if an operating system issued the SIGP set-MTorder with a PSMTID value 1, the CPU address would be shifted left by 1bit; if PSMTID was 2 or 3, the CPU address would be shifted left by 2bits, if PSMTID is 4-7, the CPU address would be shifted left by 3 bits,and so forth.

When multithreading is subsequently disabled (as a result of a clearreset or CPU reset caused by a load-normal operation), CPU addresscontraction occurs. The MT-enabled CPU address can be shifted right bythe same number of PSMTID bits used in the SIGP set-MT order thatenabled MT, and the thread-ID portion of the address disappears. Thethread context that is accessible during MT mode can reside in one ormore locations, such as the example depicted in FIG. 10. In the exampleof FIG. 10, a configuration 1000 includes core 1002 and may includeother cores (not depicted). Memory 1006 can include configuration memory1005 as part of the configuration 1000 and host/firmware memory 1007that is separate from the configuration 1000. The host/firmware memory1007 can include a state-description block 1008 maintained by a host,which may store a thread context 1010 for a thread (e.g., thread n inFIG. 10). A satellite block 1012 may be anchored to thestate-description block 1008 in the memory 1006 as part of thehost/firmware memory 1007, where the satellite block 1012 can includethread context 1014 as an alternative to the thread context 1010 or incombination with the thread context 1010. Each thread may have acorresponding state-description block 1008 and optionally a satelliteblock 1012, where thread context 1010 or thread context 1014 can bestored. As a further alternative, hardware context registers 1016 can beused to store a thread context 1018, for instance, in core 1002. Theexamples of thread context 1010, 1014, and 1018 can be used incombination or separately as storage options. Alternate storage optionscan be employed in embodiments. Regardless of where thread context ismaintained, upon address contraction, the thread context may no longerbe directly accessible, but can be preserved for access by a dumpprogram.

When MT is disabled, the CPU-address-contraction process makes threads1-n of a core no longer addressable; similarly, the thread contextincluding architected registers is no longer visible to a program. If MTwas disabled as a result of a CPU reset resulting from a non-clearingload operation, the register context of threads 1-n is retained; thesedata may subsequently be inspected if the configuration is returned tothe MT mode. Register context for each guest thread can be maintained bya host in the thread's state-description block 1008 (or as in the caseof vector registers, in a satellite block 1012 anchored in the statedescription) as depicted in FIG. 10.

Retention of the context of threads 1-n during the disablement of MT isa diagnostic feature for the state of the threads to be dumped followingan OS failure. Following an OS failure, an operator may choose to run astand-alone-dump (SADMP) program to capture the memory and threadcontext of the system at the time of the failure. However, loading theSADMP program can cause the configuration to revert to a defaultarchitectural mode with ST mode enabled, thus MT is disabled. But,because SADMP is loaded by a non-clearing load operation, the registercontext of threads 1-n of each core is retained. SADMP can determinewhether MT was enabled in the configuration being dumped by examiningthe results of a SERVC read-SCP-information command's response block.This number can subsequently be used as input to the SIGP set-MT orderto re-enable MT at the same level as before.

FIG. 11 depicts an example of multithreading register preservation inaccordance with an embodiment. A system, such as a computer system 1100of FIG. 11, may include multiple configurations 1102 and 1104. In theexample of FIG. 11, configuration 1102 includes core 1106 and core 1108,and configuration 1104 includes core 1110 and core 1112. Each of theconfigurations 1102 and 1104 can independently be switched between STand MT modes at different times. Each of the configurations 1102 and1104 of the computer system 1100 is configurable with a different numberof maximum thread-IDs to support a simultaneously enabled differentnumber of threads at each of the configurations 1102 and 1104. In theexample of FIG. 11, cores 1106 and 1108 each support a maximum of twothreads while configuration 1102 is in MT mode 1114, whereas cores 1110and 1112 each support a maximum of four threads while configuration 1104is in MT mode 1116.

While MT mode 1114 is enabled in configuration 1102, both TID 0 and TID1 are accessible as separate thread contexts, such as separate instancesof thread context 1115. At time 1118, the MT mode 1114 may be disabledby a load-normal operation or a non-clearing reset for the configuration1102, which switches both cores 1106 and 1108 into ST mode 1120. Due toaddress contraction as previously described, TID0 registers areaccessible in ST mode 1120; however, TID1 registers that were accessiblein the MT mode 1114 are retained but no longer accessible. For example,the TID1 registers may be embodied as thread context 1010, 1014, or 1018of FIG. 10, where an address that was available with address expansionis no longer accessible after address contraction upon switching to STmode 1120.

While configuration 1104 has MT mode 1116 enabled, TID0, TID1, TID2, andTID3 registers are accessible as separate thread context, such asseparate instances of thread context 1010, 1014, or 1018 of FIG. 10. Inthis example, TID0 represents a primary thread and TID1-TID3 representsecondary threads that are separately maintained for each of the cores1110 and 1112. At time 1122, the MT mode 1116 may be disabled by aclearing reset for the configuration 1104, which switches both cores1110 and 1112 into ST mode 1124. The clearing reset at time 1122 canclear all of the registers of TID0, TID1, TID2, and TID3. Due to addresscontraction as previously described, TID0 registers are accessible in STmode 1124; however, TID1, TID2, and TID3 registers that were accessiblein the MT mode 1116 are retained in a cleared state but no longeraccessible. As depicted in FIG. 11, operations can be independentlyperformed on each configuration 1102 and 1104 at different times 1118and 1122 with the effects localized to each configuration 1102 and 1104.Thus, configuration 1102 can be in ST mode 1120 while configuration 1104is in MT mode 1116, and the ST/MT modes need not be aligned for allconfigurations of the computer system 1100.

FIG. 12 depicts a process flow 1200 for multithreading registerpreservation in accordance with an embodiment. At block 1202, based ondetermining by a core in the MT mode, that MT is to be disabled in thecore, switching from the MT mode to the ST mode is performed. Theprimary thread of the MT mode can be maintained as the only thread ofthe ST mode. One or more thread contexts that include program accessibleregister values and program counter values of secondary threads are madeinaccessible to application programs. At block 1204, based on theswitching, an operation type (e.g., clearing vs. non-clearing) isdetermined to either clear the program accessible register values orretain the program accessible register values is performed. At block1206, based on a non-clearing operation, it is determined that theprogram accessible register values are to be retained. At block 1208,based on a clearing operation, it is determined that the programaccessible registers are to be cleared.

As previously described, the program accessible register values andprogram counter values of thread context can include program generalpurpose registers, floating-point registers, control registers, accessregisters, a prefix register, and TOD programmable registers. Thecontrol registers can include a floating-point control register,runtime-instrumentation controls, CPU-measurement controls, and thelike. Other examples of registers that can be included in the threadcontext include a program-status word (e.g., including a programcounter/instruction address, condition code, and other information tocontrol instruction sequencing and to determine CPU state), vectorregisters, a CPU timer, a clock comparator, a breaking-event addressregister, and other registers known in the art. As previously described,the PSMTID is set based on a last successfully executed signal processorinstruction that caused MT to be enabled. Based on switching to the MTmode, the program accessible register values are made accessible toapplication programs based on corresponding secondary threads beingre-enabled. For example, switching from ST mode 1120 back to MT mode1114 in FIG. 11 allows TID1 registers to be accessed, and TID1 may bere-enabled. Thread context can be maintained in any of: astate-description block, a satellite block anchored to thestate-description block in memory, or a context register, such as threadcontext 1010, 1014, or 1018 of FIG. 10.

A primary thread context can include program accessible register valuesand program counter values of a primary thread, e.g. TID0 and TID0registers for configuration 1104 of FIG. 11, where the primary threadcontext is accessible to application programs in both the ST mode 1124and the MT mode 1116. A secondary thread context can include programaccessible register values and program counter values of a secondarythread, e.g. TID1-TID3 and TID1-TID3 registers for configuration 1104 ofFIG. 11.

FIG. 13 depicts an example of multithreading register restoration inaccordance with an embodiment. The example of FIG. 13 includes acomputer system 1300 with a single configuration 1302. The configuration1302 includes core 1304, core 1306, and core 1308. Each of the cores1304-1308 includes a maximum of four threads (TID0, TID1, TID2, andTID3) in this example. In MT mode 1310, all of thread context ofTID0-TID3 is available in cores 1304-1308. At time 1312, the MT mode1310 may be disabled by a load-normal operation or a non-clearing resetof the configuration 1302, which switches cores 1304-1308 into ST mode1314. In ST mode 1314, TID0 registers remain accessible, and TID1-TID3registers are inaccessible but are retained for each of the cores1304-1308. At time 1316, MT can be re-enabled by execution of a SIGPset-MT order to enter a resumed MT mode 1318. In the resumed MT mode1318, access to thread context of TID1-TID3 registers for each of thecores 1304-1308 is restored. This enables inspection of all of thethread's registers, including the TID1-TID3 registers, by a dumpprogram, such as stand-alone dump program 1320, to save thread contextinformation for analysis.

FIG. 14 depicts a process flow 1400 for multithreading registerrestoration in accordance with an embodiment as may be employed by astand-alone dumping (SADMP) program, such as stand-alone dump program1320 of FIG. 13, to capture the architected register context of threadsfollowing the failure of an operating system. At block 1405, a SADMPprogram is loaded via a non-clearing load operation (e.g., load normalor load-with-dump). The non-clearing load operation implicitly causesthe configuration to revert to the ST mode, such as ST mode 1314 forconfiguration 1302 of FIG. 13. The SADMP program can then query whetherthe MT facility is available in the configuration at block 1410 by usingthe STSI or SERVC instruction. If MT is installed, the SADMP programqueries the last-set program-specified maximum thread identification(PSMTID) set for the configuration at block 1415. If MT had neverpreviously been set for the configuration, the last-set PSMTID valuewill be zero. The SADMP program can then execute the instruction tore-enable multithreading at block 1420 at whatever the last-set PSMTIDwas (even if it was zero). If the query at block 1410 reveals that MT isnot installed, then no attempt is made to query the last-set PSMTIDvalue at block 1415 or re-enable MT at block 1420.

The SADMP program attempts to signal each other CPU (thread) in theconfiguration to save its architected register context in a predefinedlocation in memory. If MT was not previously enabled prior to loadingSADMP, the CPU addresses are the normal, non-expanded format. If MT waspreviously enabled, the CPU addresses are the expanded format includinga core ID and thread ID. SADMP begins with a CPU address (N) of zero atblock 1425, and determines whether that CPU address represents the CPUupon which SADMP is executing at block 1430. If so, that CPU/thread isskipped, and N is incremented to the next value at block 1450. If Ndiffers from the current CPU address, then that CPU/thread is signaledto store its architected register context in memory, for example, by theexecution of either a SIGP store-status-at-address order or a SIGPstop-and-store-status order at block 1435. If the configuration includesa vector facility, a SIGP store-additional-status-at-address order mayalso be executed to store the contents of the CPU/thread's vectorregisters. A determination is made as to whether the signal of block1435 was successful at block 1440. If successful, the SADMP program maysave the CPU/thread's register context in a dump file on tape or disk atblock 1445, and processing continues by incrementing N at block 1450. Ifthe signal of block 1435 is not successful (for example, if the threadis not operational) as determined by block 1440, then it is skipped, andprocessing continues by incrementing N at block 1450. The value of theCPU address used in signaling (N) is incremented at block 1450, and adetermination is made as to whether N is now greater than thehighest-possible CPU address for the configuration at block 1455. If Nis not greater than the highest-possible CPU address for theconfiguration, then processing continues by determining whether Nrepresents the current CPU/thread under which the SADMP program isexecuting at block 1430. If N is greater than the highest-possible CPUaddress for the configuration, then the architected register contextrestoration and dumping has completed at block 1460.

Although FIG. 14 is described with respect to one core of aconfiguration, it will be understood that the process flow 1400 of FIG.14 can be extended to run through the maximum CPU address across allcores of a configuration that includes multiple cores. Additionalaccommodations can be made in configurations to support dumping for anOS that does not support MT or a program that is MT-aware but does notexploit MT. For example, a clearing reset can be performed prior toloading an OS that does not support MT in the configuration to preventan MT-aware stand-alone dump program from attempting to dump anysecondary threads from the configuration. As another example, a programthat is MT-aware but does not exploit MT, can issue a set-MT order witha corresponding maximum thread-id of zero prior to executing astand-alone dump program for the configuration.

Technical effects and benefits include retrieval of multithreadingcapability information and making the multithreading capabilityinformation available. The multithreading capability information allowsa control program to discover multithreading constraints to ensure adesired number of threads can be supported. The multithreadingcapability information can also be used to assist in re-enablingmultithreading mode from a single threaded mode with the same number ofthreads as previously used when multithreading was last enabled.

The system described herein enables software to mitigate hardwarevariability by requiring an OS to explicitly “opt in” to exploit the MThardware. When the OS understands the MT nature of the executionenvironment, the OS has the ability to explicitly manage the per-corethread densities (to the best of its ability, given a workload dispatchpattern). The OS has the option to maintain high thread densities evenwhen compute resources are less utilized, thereby mitigating much of thevariability in total compute capacity that is seen on other MTimplementations. As a direct result of maintaining high threaddensities, both the transaction response times and billing aspects maybe more consistent.

Embodiments include a system, method, and computer program product formultithreading capability information retrieval. According to oneaspect, a computer system includes a configuration with one or morecores configurable between a single thread (ST) mode and amultithreading (MT) mode. The ST mode addresses a primary thread and theMT mode addresses the primary thread and one or more secondary threadson shared resources of each core. The computer system also includes amultithreading facility configured to control utilization of theconfiguration to perform a method that includes executing, by a core, aretrieve multithreading capability information (RMTCI) instruction. Theexecution includes obtaining thread identification information thatidentifies multithreading capability of the configuration, and storingthe obtained thread identification information.

According to another aspect, a computer-implemented method formultithreading capability information retrieval in a configuration isprovided. The configuration includes one or more cores configurablebetween an ST mode and an MT mode, where the ST mode addresses a primarythread and the MT mode addresses the primary thread and one or moresecondary threads on shared resources of each core. The method includesexecuting, by a core, a retrieve multithreading capability informationinstruction. The execution includes obtaining thread identificationinformation that identifies multithreading capability of theconfiguration, and storing the obtained thread identificationinformation.

A further aspect includes a computer program product for implementingmultithreading capability information retrieval in a configuration. Theconfiguration includes one or more cores configurable between an ST modeand an MT mode, where the ST mode addresses a primary thread and the MTmode addresses the primary thread and one or more secondary threads onshared resources of each core. The computer program product includes acomputer readable storage medium having program instructions embodiedtherewith, where the computer readable storage medium is not a signal.The program instructions are readable by a processing circuit to causethe processing circuit to perform a method. The method includesexecuting, by a core, a retrieve multithreading capability informationinstruction. The execution includes obtaining thread identificationinformation that identifies multithreading capability of theconfiguration, and storing the obtained thread identificationinformation.

In addition to one or more of the features described above, or as analternative, further embodiments can include where the RMTCI instructionis any one of a service call (SERVC) instruction or a store systeminformation (STSI) instruction. The SERVC instruction can be configuredto store the thread identification information in a response block inmemory, and the STSI instruction can be configured to store the threadidentification information in a system information block (SYSIB) inmemory.

In addition to one or more of the features described above, or as analternative, further embodiments can include where the response blockfurther includes a mask of bits indicating specific program-specifiedmaximum thread identifier values that are individually supported.

In addition to one or more of the features described above, or as analternative, further embodiments can include where the obtained threadinformation includes an MT installed identifier indicating whether theconfiguration supports multithreading.

In addition to one or more of the features described above, or as analternative, further embodiments can include where the obtained threadinformation includes a maximum thread identifier of a highest supportedthread of the core.

In addition to one or more of the features described above, or as analternative, further embodiments can include where the obtained threadinformation includes a most recently set program-specified maximumthread identifier of a highest thread identification of the core.

In addition to one or more of the features described above, or as analternative, further embodiments can include determining that theconfiguration previously had MT enabled based on a non-zero value in themost recently set program-specified maximum thread identifier.

In addition to one or more of the features described above, or as analternative, further embodiments can include where the configurationsupports a plurality of core types, and separate instances of a maximumthread identifier are maintained for each of the core types in theconfiguration.

The terminology used herein is for the purpose of describing particularembodiments only and is not intended to be limiting of the invention. Asused herein, the singular forms “a”, “an” and “the” are intended toinclude the plural forms as well, unless the context clearly indicatesotherwise. It will be further understood that the terms “comprises”and/or “comprising,” when used in this specification, specify thepresence of stated features, integers, steps, operations, elements,and/or components, but do not preclude the presence or addition of oneor more other features, integers, steps, operations, element components,and/or groups thereof.

The corresponding structures, materials, acts, and equivalents of allmeans or step plus function elements in the claims below are intended toinclude any structure, material, or act for performing the function incombination with other claimed elements as specifically claimed. Thedescription of the present invention has been presented for purposes ofillustration and description, but is not intended to be exhaustive orlimited to the invention in the form disclosed. Many modifications andvariations will be apparent to those of ordinary skill in the artwithout departing from the scope and spirit of the invention. Theembodiment was chosen and described in order to best explain theprinciples of the invention and the practical application, and to enableothers of ordinary skill in the art to understand the invention forvarious embodiments with various modifications as are suited to theparticular use contemplated.

The descriptions of the various embodiments of the present inventionhave been presented for purposes of illustration, but are not intendedto be exhaustive or limited to the embodiments disclosed. Manymodifications and variations will be apparent to those of ordinary skillin the art without departing from the scope and spirit of the describedembodiments. The terminology used herein was chosen to best explain theprinciples of the embodiments, the practical application or technicalimprovement over technologies found in the marketplace, or to enableothers of ordinary skill in the art to understand the embodimentsdisclosed herein.

Referring now to FIG. 15, a computer program product 1500 in accordancewith an embodiment that includes a computer readable storage medium 1502and program instructions 1504 is generally shown.

The present invention may be a system, a method, and/or a computerprogram product. The computer program product may include a computerreadable storage medium (or media) having computer readable programinstructions thereon for causing a processor to carry out aspects of thepresent invention.

The computer readable storage medium can be a tangible device that canretain and store instructions for use by an instruction executiondevice. The computer readable storage medium may be, for example, but isnot limited to, an electronic storage device, a magnetic storage device,an optical storage device, an electromagnetic storage device, asemiconductor storage device, or any suitable combination of theforegoing. A non-exhaustive list of more specific examples of thecomputer readable storage medium includes the following: a portablecomputer diskette, a hard disk, a random access memory (RAM), aread-only memory (ROM), an erasable programmable read-only memory (EPROMor Flash memory), a static random access memory (SRAM), a portablecompact disc read-only memory (CD-ROM), a digital versatile disk (DVD),a memory stick, a floppy disk, a mechanically encoded device such aspunch-cards or raised structures in a groove having instructionsrecorded thereon, and any suitable combination of the foregoing. Acomputer readable storage medium, as used herein, is not to be construedas being transitory signals per se, such as radio waves or other freelypropagating electromagnetic waves, electromagnetic waves propagatingthrough a waveguide or other transmission media (e.g., light pulsespassing through a fiber-optic cable), or electrical signals transmittedthrough a wire.

Computer readable program instructions described herein can bedownloaded to respective computing/processing devices from a computerreadable storage medium or to an external computer or external storagedevice via a network, for example, the Internet, a local area network, awide area network and/or a wireless network. The network may comprisecopper transmission cables, optical transmission fibers, wirelesstransmission, routers, firewalls, switches, gateway computers and/oredge servers. A network adapter card or network interface in eachcomputing/processing device receives computer readable programinstructions from the network and forwards the computer readable programinstructions for storage in a computer readable storage medium withinthe respective computing/processing device.

Computer readable program instructions for carrying out operations ofthe present invention may be assembler instructions,instruction-set-architecture (ISA) instructions, machine instructions,machine dependent instructions, microcode, firmware instructions,state-setting data, or either source code or object code written in anycombination of one or more programming languages, including an objectoriented programming language such as Smalltalk, C++ or the like, andconventional procedural programming languages, such as the “C”programming language or similar programming languages. The computerreadable program instructions may execute entirely on the user'scomputer, partly on the user's computer, as a stand-alone softwarepackage, partly on the user's computer and partly on a remote computeror entirely on the remote computer or server. In the latter scenario,the remote computer may be connected to the user's computer through anytype of network, including a local area network (LAN) or a wide areanetwork (WAN), or the connection may be made to an external computer(for example, through the Internet using an Internet Service Provider).In some embodiments, electronic circuitry including, for example,programmable logic circuitry, field-programmable gate arrays (FPGA), orprogrammable logic arrays (PLA) may execute the computer readableprogram instructions by utilizing state information of the computerreadable program instructions to personalize the electronic circuitry,in order to perform aspects of the present invention.

Aspects of the present invention are described herein with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems), and computer program products according to embodiments of theinvention. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer readable program instructions.

These computer readable program instructions may be provided to aprocessor of a general purpose computer, special purpose computer, orother programmable data processing apparatus to produce a machine, suchthat the instructions, which execute via the processor of the computeror other programmable data processing apparatus, create means forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks. These computer readable program instructionsmay also be stored in a computer readable storage medium that can directa computer, a programmable data processing apparatus, and/or otherdevices to function in a particular manner, such that the computerreadable storage medium having instructions stored therein comprises anarticle of manufacture including instructions which implement aspects ofthe function/act specified in the flowchart and/or block diagram blockor blocks.

The computer readable program instructions may also be loaded onto acomputer, other programmable data processing apparatus, or other deviceto cause a series of operational steps to be performed on the computer,other programmable apparatus or other device to produce a computerimplemented process, such that the instructions which execute on thecomputer, other programmable apparatus, or other device implement thefunctions/acts specified in the flowchart and/or block diagram block orblocks.

The flowchart and block diagrams in the Figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods, and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof instructions, which comprises one or more executable instructions forimplementing the specified logical function(s). In some alternativeimplementations, the functions noted in the block may occur out of theorder noted in the figures. For example, two blocks shown in successionmay, in fact, be executed substantially concurrently, or the blocks maysometimes be executed in the reverse order, depending upon thefunctionality involved. It will also be noted that each block of theblock diagrams and/or flowchart illustration, and combinations of blocksin the block diagrams and/or flowchart illustration, can be implementedby special purpose hardware-based systems that perform the specifiedfunctions or acts or carry out combinations of special purpose hardwareand computer instructions.

What is claimed is:
 1. A computer system, comprising: a configurationcomprising one or more cores configurable between a single thread (ST)mode and a multithreading (MT) mode, wherein the ST mode addresses aprimary thread and the MT mode addresses the primary thread and one ormore secondary threads on shared resources of each of the one or morecores; and a multithreading facility configured to control utilizationof the configuration to perform a method comprising: executing, by acore, a retrieve multithreading capability information (RMTCI)instruction, wherein the execution comprises: obtaining threadidentification information that identifies a multithreading capabilityof the configuration; storing the obtained thread identificationinformation; and determining whether the configuration previously had MTenabled based on the obtained thread identification information.
 2. Thecomputer system according to claim 1, wherein the RMTCI instruction isany one of a service call (SERVC) instruction or a store systeminformation (STSI) instruction, wherein the SERVC instruction isconfigured to store the thread identification information in a responseblock in memory, and wherein the STSI instruction is configured to storethe thread identification information in a system information block(SYSIB) in memory.
 3. The computer system according to claim 2, whereinthe response block further comprises a mask of bits indicating specificprogram-specified maximum thread identifier values that are individuallysupported.
 4. The computer system according to claim 1, wherein theobtained thread information comprises an MT installed identifierindicating whether the one or more cores support multithreading.
 5. Thecomputer system according to claim 1, wherein the obtained threadinformation comprises a maximum thread identifier of a highest supportedthread of the core.
 6. The computer system according to claim 1, whereinthe obtained thread information comprises a most recently setprogram-specified maximum thread identifier of a highest thread of theconfiguration.
 7. The computer system according to claim 6, wherein themethod further comprises: determining that the configuration previouslyhad MT enabled based on a non-zero value in the most recently setprogram-specified maximum thread identifier of the highest thread of theconfiguration.
 8. The computer system according to claim 1, wherein theconfiguration supports a plurality of core types, and wherein separateinstances of a maximum thread identifier are maintained for each of theplurality of core types in the configuration.
 9. A computer-implementedmethod for multithreading capability information retrieval in aconfiguration, the computer-implemented method comprising: executing, bya core, a retrieve multithreading capability information (RMTCI)instruction, wherein the execution comprises: obtaining threadidentification information that identifies a multithreading capabilityof the configuration, wherein the configuration comprises one or morecores configurable between a single thread (ST) mode and amultithreading (MT) mode, wherein the ST mode addresses a primarythread, and wherein the MT mode addresses the primary thread and one ormore secondary threads on shared resources of each of the one or morecores; storing the obtained thread identification information; anddetermining whether the configuration previously had MT enabled based onthe obtained thread identification information.
 10. Thecomputer-implemented method according to claim 9, wherein the RMTCIinstruction is any one of a service call (SERVC) instruction or a storesystem information (STSI) instruction, wherein the SERVC instruction isconfigured to store the thread identification information in a responseblock in memory, and wherein the STSI instruction is configured to storethe thread identification information in a system information block(SYSIB) in memory.
 11. The computer-implemented method according toclaim 10, wherein the response block further comprises a mask of bitsindicating specific program-specified maximum thread identifier valuesthat are individually supported.
 12. The computer-implemented methodaccording to claim 9, wherein the obtained thread information comprisesan MT installed identifier indicating whether the one or more coressupport multithreading.
 13. The computer-implemented method according toclaim 9, wherein the obtained thread information comprises a maximumthread identifier of a highest supported thread of the core.
 14. Thecomputer-implemented method according to claim 9, wherein the obtainedthread information comprises a most recently set program-specifiedmaximum thread identifier of a highest thread of the configuration. 15.The computer-implemented method according to claim 14, furthercomprising: determining that the configuration previously had MT enabledbased on a non-zero value in the most recently set program-specifiedmaximum thread identifier of the highest thread of the configuration.16. A computer program product for implementing multithreadingcapability information retrieval in a configuration, the computerprogram product comprising: a computer readable storage medium havingprogram instructions embodied therewith, wherein the computer readablestorage medium is not a signal, and wherein the program instructions arereadable by a processing circuitry to cause the processing circuitry toperform a method comprising: executing, by a core, a retrievemultithreading capability information (RMTCI) instruction, wherein theexecution comprises: obtaining thread identification information thatidentifies a multithreading capability of the configuration, wherein theconfiguration comprises one or more cores configurable between a singlethread (ST) mode and a multithreading (MT) mode, wherein the ST modeaddresses a primary thread, and wherein the MT mode addresses theprimary thread and one or more secondary threads on shared resources ofeach of the one or more cores; storing the obtained threadidentification information; and determining whether the configurationpreviously had MT enabled based on the obtained thread identificationinformation.
 17. The computer program product according to claim 16,wherein the RMTCI instruction is any one of a service call (SERVC)instruction or a store system information (STSI) instruction, whereinthe SERVC instruction is configured to store the thread identificationinformation in a response block in memory, and wherein the STSIinstruction is configured to store the thread identification informationin a system information block (SYSIB) in memory.
 18. The computerprogram product according to claim 17, wherein the response blockfurther comprises a mask of bits indicating specific program-specifiedmaximum thread identifier values that are individually supported. 19.The computer program product according to claim 16, wherein the obtainedthread information comprises an MT installed identifier indicatingwhether the one or more cores support multithreading.
 20. The computerprogram product according to claim 16, wherein the obtained threadinformation comprises a maximum thread identifier of a highest supportedthread of the core.